package com.chat.api.utils.util;


import com.chat.api.common.exception.CoreExceptionEnum;
import com.chat.api.web.vo.MessageEntity;

/**
 * @author chengw
 */
public class ResultUtil {

    public static MessageEntity success(Object data){

        return new MessageEntity(CoreExceptionEnum.OK.getCode(), data, "成功");

    }

    public static MessageEntity fail(Exception e){
        e.printStackTrace();
        return new MessageEntity(CoreExceptionEnum.E_FAIL.getCode(), e.getLocalizedMessage());

    }

    public static MessageEntity fail(String errInfo){
        return new MessageEntity(CoreExceptionEnum.E_FAIL.getCode(), errInfo);

    }

}
